<?php
/**
 * Created by PhpStorm.
 * User: hehecat
 * Date: 2018/7/10
 * Time: 13:22
 */

namespace app\api\controller;


use app\api\model\EnrollModel;
use think\Controller;

class Enroll extends Controller
{
    /**
     * @title 订单列表
     * @author hehecat
     * @moudle 订单模块
     *
     * @param userid type:int desc:用户id
     * @param sessionid type:string desc:用户sessionid
     * @return enrolllist desc:二维数组 包括了train、game、course、activity订单
     */
    function enrolllist() {
        $userid = input('get.userid');
        $sessionid = input('get.sessionid');

        $redis = getRedis();
        if ($sessionid!='' && $sessionid == $redis->get($userid)) {
            $model = new EnrollModel();
            $result = $model->enrolllist($userid);
            return json($result);
        }
        return  json(['error'=>'sessionid无效']);
    }
}